package org.jeecg.modules.oa.service.impl;

import org.jeecg.common.util.StringUtils;
import org.jeecg.modules.oa.entity.Accpect;
import org.jeecg.modules.oa.entity.ApprovalNode;
import org.jeecg.modules.oa.entity.ButtonCondition;
import org.jeecg.modules.oa.mapper.ApprovalNodeMapper;
import org.jeecg.modules.oa.mapper.ButtonConditionMapper;
 ;
import org.jeecg.modules.oa.service.IButtonConditionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import java.util.List;

/**
 * @Description: 按钮条线表
 * @Author: jeecg-boot
 * @Date:   2019-12-10
 * @Version: V1.0
 */
@Service
public class ButtonConditionServiceImpl extends ServiceImpl<ButtonConditionMapper, ButtonCondition> implements IButtonConditionService {
@Autowired
private ApprovalNodeMapper approvalNodeMapper;
@Autowired
private ButtonConditionMapper buttonConditionMapper;
 @Override
 public List<ApprovalNode> selectNode(String mainId) {
  return approvalNodeMapper.selectNode(mainId);
 }

 @Override
 public Integer updateCondition(String buttonId,String conditionFlg) {
  return approvalNodeMapper.updateCondition(buttonId,conditionFlg);
 }

 @Override
 public void saveBatchCondition(List<Accpect> buttonConditionList) {

 }

 @Override
 public void saveCondition(ButtonCondition bc) {
    if (StringUtils.isEmpty(bc.getId())){
     buttonConditionMapper.insert(bc);
    }else {
     buttonConditionMapper.updateById(bc);
    }
 }
}
